for _ in range(int(input())):
a, b, c = sorted([int(c) for c in input().split()])
print(a+b if c > a + b else (a+b+c)//2)
// 1100: Sweet Problem
// Jan 11 2023
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
void solve(){
long r,g,bl,a,b,c;
cin >> r >> g >> bl;
vector<int> vect{r, g, bl };
sort(vect.begin(),vect.end());
c = vect[0];
b = vect[1];
a = vect[2];
if(a > b+c){
cout << b+c << endl;
}
else{
long result = (a+b+c)/2;
cout << result << endl;
}
}
int main() {
int t;
cin >> t;
for(int i = 0; i < t;i++){
solve();
}
}
1452A - Robot Program | 344A - Magnets |
96A - Football | 702B - Powers of Two |
1036A - Function Height | 443A - Anton and Letters |
1478B - Nezzar and Lucky Number | 228A - Is your horseshoe on the other hoof |
122A - Lucky Division | 1611C - Polycarp Recovers the Permutation |
432A - Choosing Teams | 758A - Holiday Of Equality |
1650C - Weight of the System of Nested Segments | 1097A - Gennady and a Card Game |
248A - Cupboards | 1641A - Great Sequence |
1537A - Arithmetic Array | 1370A - Maximum GCD |
149A - Business trip | 34A - Reconnaissance 2 |
59A - Word | 462B - Appleman and Card Game |
1560C - Infinity Table | 1605C - Dominant Character |
1399A - Remove Smallest | 208A - Dubstep |
1581A - CQXYM Count Permutations | 337A - Puzzles |
495A - Digital Counter | 796A - Buying A House |